package models.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "Customer")
public class Customer {

	@Id
	@Column(name = "id")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "taxIdentificationId")
	private String taxIdentificationId;

	@Column(name = "FirstName")
	private String FirstName;

	@Column(name = "LastName")
	private String LastName;

	@Column(name = "e_mail")
	private String e_mail;

	@Column(name = "identificationId")
	private String identificationId;

	@Embedded
	private Address address = new Address();

	@Embedded
	private User user = new User();

	@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
	@JoinColumn(name = "contractId")
	private List<Contract> contracts = new ArrayList<Contract>();

	public Customer() {
		super();
	}

	public Customer(String aFM, String firstName, String lastName,
			String e_mail, String aDT, Address address, User user,
			ArrayList<Contract> contracts) {
		super();
		taxIdentificationId = aFM;
		FirstName = firstName;
		LastName = lastName;
		this.e_mail = e_mail;
		identificationId = aDT;
		this.address = address;
		this.user = user;
		this.contracts = contracts;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getAFM() {
		return taxIdentificationId;
	}

	public void setAFM(String aFM) {
		taxIdentificationId = aFM;
	}

	public String getFirstName() {
		return FirstName;
	}

	public void setFirstName(String firstName) {
		FirstName = firstName;
	}

	public String getLastName() {
		return LastName;
	}

	public void setLastName(String lastName) {
		LastName = lastName;
	}

	public String getE_mail() {
		return e_mail;
	}

	public void setE_mail(String e_mail) {
		this.e_mail = e_mail;
	}

	public String getADT() {
		return identificationId;
	}

	public void setADT(String aDT) {
		identificationId = aDT;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<Contract> getContracts() {
		return contracts;
	}

	public void setContracts(List<Contract> contracts) {
		this.contracts = contracts;
	}

}
